package com.charactereducation.api.controller;

import com.charactereducation.api.service.activity.ActivityServiceClient;
import com.charactereducation.api.service.user.UserServiceClient;
import com.charactereducation.module.vo.Activity;
import com.charactereducation.module.vo.User;
import com.charactereducation.webcore.controller.BaseController;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created by Baggio on 2018-6-25.
 */
@RestController
@RequestMapping("user")
public class UserController extends BaseController {
    @Autowired
    UserServiceClient userServiceClient;

    @PostMapping(value = "/addUser",produces = MediaType.APPLICATION_JSON_VALUE)
    public void modify() {
        User user = (User) super.json2Obj(User.class);
        userServiceClient.addUser(user);

    }
    @PostMapping(value = "/login",produces = MediaType.APPLICATION_JSON_VALUE)
    public User activityList(@RequestParam("phone") String phone,@RequestParam("passWord") String passWord) {
        User user = userServiceClient.login(phone,passWord);
        return user;
    }
}
